<?php
if ($this -> session -> userdata('admin_type') == 'Web Admin') {
	$this -> admin = 'admin';
} else {
	redirect(BASE_URL);
}
$this -> load -> view('admin/head');
$this -> load -> view('admin/header');
?>
<!-- Content -->
<div class="space30"></div>
<div class="container">
	<div class="row">
		<div class="col-md-2">
			<nav class="navbar1">
				<?php $this -> load -> view('admin/left_nav'); ?>
			</nav>
		</div>
   <div class="col-md-10">
        <!--form starts-->
        	<div class="form_container">
            		<h4>Manage Admin</h4>
                    <!--row starts-->
                    	<div class="row1">
                    	<div class="form-group col-sm-12">
                        	<form action="" method="post">
                            <label for="name2">Name</label>
							<input type="text" class="form-control white" id="name_search" name="name_search" value="<?php echo $this -> input -> post('name_search'); ?>">
                            <span class="error_msg"><?php echo form_error('name_search'); ?> </span>	
                        </div>
                        <div class="form-group col-sm-12">
                        	<label for="email2">Email</label>
                            <input type="text" class="form-control white" id="name_search" name="email_search" value="<?php echo $this -> input -> post('email_search'); ?>">
                            <span class="error_msg"><?php echo form_error('email_search'); ?> </span>
                             <span class="error_msg"><?php echo $this -> session -> userdata('err_search');
								$this -> session -> unset_userdata('err_search');
 ?> </span>	
                        </div>
         				<div class="form-group col-sm-12">
            			<input  type="submit" name="submit" class="btn btn-primary" value="Search" id="admin_search">
                        </form>
                        </div>
                        <div class="clearfix"></div>
                    </div>
                    <!--row closed-->
                    <span  style="color: green;font-size: 16px;margin-left: 15px;"><?php echo $this -> session -> userdata('message');
						$this -> session -> unset_userdata('message');
					?></span>
                    <!--row starts-->
                        <div class="row1">
                        <div class="table-responsive">
	                          <table border="0" cellspacing="0" cellpadding="0" class="manage_table">
	                              <tr>
	                                <td width="8%">S.No.</td>
	                                <td width="18%">Full  Name</td>
	                                <td width="15%" >Email</td>
	                                <td width="15%">Contact</td>
	                                <td width="7%">Edit</td>
	                                <td width="8%" >Delete</td>
	                                <td width="13%">Status</td>
	                              </tr>
	                              <?php  if(empty($query) || $query == NULL) {?>
	                              <tr>
	                              	<td colspan="7">
                    		 			No  Record Found!
	                              	</td>
	                              </tr>
	                              <?php  } else {
	                              	 foreach ($query as $temp => $row) {?>
	                              <tr>
	                                <td><?php echo $temp+1 ?></td>
	                                <td><?php echo $row -> admin_fullname; ?></td>
	                                <td><?php echo $row -> admin_email; ?></td>
	                                <td><?php echo $row->admin_contact_number?></td>
	                                <td><a href="<?php echo BASE_URL . '/' . $this -> admin . '/edit_admin?id=' . $row -> admin_id; ?>" ><img src="<?php echo ASSET_URL . 'img/admin/edit.png'; ?>" style="width:20px;" alt="edit"></a></td>
	                                <td><a href="<?php echo BASE_URL . '/manage_admin/delete_admin?id=' . $row -> admin_id; ?>" onClick="return confirm_alert(this);"><img src="<?php echo ASSET_URL . 'img/admin/delete.png'; ?>" style="width:20px;" alt="edit"></a></td>
	                                <td><a href="<?php echo BASE_URL . '/manage_admin/active_inactive?id=' . $row -> admin_id . '&status=' . $row -> admin_status; ?>"><img src="<?php
										if ($row -> admin_status == 'Active') { echo ASSET_URL . 'img/admin/active.png';
										} else { echo ASSET_URL . 'img/admin/inactive.png';
										}
									?>" }  style="width:70%;" alt="edit"></a></td>
	                              </tr>
	                            <?php }} ?>
	                           </table>
	                           <div class="space20"></div>
							<?php
							if (count($query) > '10') {
								$this -> load -> view('admin/manage_admin/pagination');
							}
							?>	
					</div>
                    <div class="space30"></div>
					</div>
              </div>
                    <!--row closed-->   
        </div>
        <!--form closed-->
         <div class="space30"></div>
        
      </div>
       <div class="clearfix"></div>
    </div>    
  </div>    
  
  <div class="space20"></div>  
  
   
  
  <div class="space30"></div>  
 <script type="text/javascript">
	function confirm_alert(node) {
		return confirm("Do you really want to delete Admin?");
	}
</script> 
  <!-- Content End -->
<!-- Content End -->
<?php $this -> load -> view('common/footer'); ?>